<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:a4j="http://richfaces.org/a4j"
                 xmlns:rich="http://richfaces.org/rich"
                 xmlns:c="http://java.sun.com/jsp/jstl/core"
                 xmlns:fn="http://java.sun.com/jsp/jstl/functions">
    <h:head>
        <title>中国地震局财务信息服务平台</title>
        <style type="text/css">
            input[type='submit']{
                margin:3px 5px 3px 5px;
                padding:3px 5px 3px 5px;
            }
        </style>
    </h:head>
    <h:form>
        <rich:panel header="个人党费会费" id="ipanel" styleClass="content-hight">
            <h:outputText value="年度:"/>
            <h:selectOneMenu   value="#{allDanghui.iyear}">
                <f:selectItem itemValue=" " itemLabel="-请选择年度-"/>
                <f:selectItems value="#{allDanghui.iyearLi}" />
                <a4j:ajax event="change" render="queryButton"/>
            </h:selectOneMenu>
            <h:outputText value="月份："/>
            <h:selectOneMenu   value="#{allDanghui.monthBegin}">
                <f:selectItem itemValue="" itemLabel="-请选择月份-"/>
                <f:selectItem itemValue="1" itemLabel="1月"/>
                <f:selectItem itemValue="2" itemLabel="2月"/>
                <f:selectItem itemValue="3" itemLabel="3月"/>
                <f:selectItem itemValue="4" itemLabel="4月"/>
                <f:selectItem itemValue="5" itemLabel="5月"/>
                <f:selectItem itemValue="6" itemLabel="6月"/>
                <f:selectItem itemValue="7" itemLabel="7月"/>
                <f:selectItem itemValue="8" itemLabel="8月"/>
                <f:selectItem itemValue="9" itemLabel="9月"/>
                <f:selectItem itemValue="10" itemLabel="10月"/>
                <f:selectItem itemValue="11" itemLabel="11月"/>
                <f:selectItem itemValue="12" itemLabel="12月"/>
                <a4j:ajax event="change" execute="@this" render="queryButton"/>
            </h:selectOneMenu>
            到
            <h:selectOneMenu   value="#{allDanghui.monthEnd}">
                <f:selectItem itemValue="" itemLabel="-请选择月份-"/>
                <f:selectItem itemValue="12" itemLabel="12月"/>
                <f:selectItem itemValue="11" itemLabel="11月"/>
                <f:selectItem itemValue="10" itemLabel="10月"/>
                <f:selectItem itemValue="9" itemLabel="9月"/>
                <f:selectItem itemValue="8" itemLabel="8月"/>
                <f:selectItem itemValue="7" itemLabel="7月"/>
                <f:selectItem itemValue="6" itemLabel="6月"/>
                <f:selectItem itemValue="5" itemLabel="5月"/>
                <f:selectItem itemValue="4" itemLabel="4月"/>
                <f:selectItem itemValue="3" itemLabel="3月"/>
                <f:selectItem itemValue="2" itemLabel="2月"/>
                <f:selectItem itemValue="1" itemLabel="1月"/>
                <a4j:ajax event="change" execute="@this" render="queryButton"/>
            </h:selectOneMenu>
            <a4j:commandButton id="queryButton" value="查询" action="#{allDanghui.queryHuiFeiForAll}"
                               render="tableGroup"
                               onclick="this.disabled='true'"/>
            <h:commandButton id="ebutton" value="导出Excel" action="#{allDanghui.exportExcelHui}" />
            <hr/>
            <h:panelGroup id="tableGroup">
                <div style="width:750px;height:400px;overflow:auto;">
                    <rich:dataTable id="editTable" value="#{allDanghui.huiDetail}"
                                    var="explist" rowKeyVar="rowKey"
                                    rowClasses="list-row-odd,list-row-even"
                                    headerClass="table-header"
                                    style="width: 100%"
                                    noDataLabel="无数据!">
                        <f:facet name="header">
                            <rich:columnGroup>
                                <c:forEach items="#{allDanghui.huiHeader}" var="hrow" varStatus="hstatus">
                                    <c:if test="#{hstatus.index eq 0}">
                                        <c:forEach items="#{hrow}" var="co" varStatus="status">
                                            <c:if test="#{status.index eq 0 or status.index eq 1 or status.index eq 2}">
                                                <rich:column rowspan="2">
                                                    <h:outputText value="#{co}"/>
                                                </rich:column>
                                            </c:if>
                                            <c:if test="#{status.index eq 3}">
                                                <rich:column colspan="#{fn:length(allDanghui.huiAddArr)}">
                                                    <h:outputText value="#{co}"/>
                                                </rich:column>
                                            </c:if>
                                            <c:if test="#{status.index gt 3}">
                                                <c:if test="#{empty allDanghui.huiCutArr}">
                                                    <c:if test="#{status.index gt 3}">
                                                        <rich:column rowspan="2">
                                                            <h:outputText value="#{co}"/>
                                                        </rich:column>
                                                    </c:if>
                                                </c:if>
                                                <c:if test="#{not empty allDanghui.huiCutArr}">
                                                    <c:if test="#{status.index eq 4}">
                                                        <rich:column colspan="#{fn:length(allDanghui.huiCutArr)}">
                                                            <h:outputText value="#{co}"/>
                                                        </rich:column>
                                                    </c:if>
                                                    <c:if test="#{status.index gt 4}">
                                                        <rich:column rowspan="2">
                                                            <h:outputText value="#{co}"/>
                                                        </rich:column>
                                                    </c:if>
                                                </c:if>
                                            </c:if>
                                        </c:forEach>
                                    </c:if>
                                    <c:if test="#{hstatus.index eq 1}">
                                        <c:forEach items="#{hrow}" var="co" varStatus="status">
                                            <c:if test="#{status.index eq 0}">
                                                <rich:column breakRowBefore="true">
                                                    <h:outputText value="#{co}"/>
                                                </rich:column>
                                            </c:if>
                                            <c:if test="#{!(status.index eq 0)}">
                                                <rich:column>
                                                    <h:outputText value="#{co}"/>
                                                </rich:column>
                                            </c:if>
                                        </c:forEach>
                                    </c:if>
                                </c:forEach>
                            </rich:columnGroup>
                        </f:facet>
                        <c:forEach begin="0" end="#{fn:length(allDanghui.huiDetail[0])-1}" step="1" var="col">
                            <rich:column style="text-align: right">
                                <h:outputText value="#{explist[col]}">
                                    <f:convertNumber pattern="#,##0.00" type="number"/>
                                </h:outputText>
                            </rich:column>
                        </c:forEach>
                    </rich:dataTable>
                </div>
            </h:panelGroup>
        </rich:panel>
    </h:form>
</ui:composition>